package Entity;

/**
 * Class to create a diecup. This class will take in 2 dice.
 *
 * @author DTU 02312 Gruppe 19
 *
 */
public class DieCup {

    private Die die1, die2;

    /**
     * Constructor that set up two new dice.
     */
    public DieCup() {
        this.die1 = new Die();
        this.die2 = new Die();
    }

    /**
     * Method to shake the diecup.
     */
    public void shakeDieCup() {
        this.die1.roll();
        this.die2.roll();
    }

    /**
     * Adds value from die1 and die2.
     *
     * @return The sum of die1 and die2.
     */
    public int getSum() {
        return this.die1.getValue() + this.die2.getValue();
    }
    
    /**
     * Get faceValue from die1
     *
     * @return The current value of die1.
     */
    public int getValueDie1() {
        return this.die1.getValue();
    }
    
    /**
     * Get faceValue from die2
     *
     * @return The current value of die2.
     */
    public int getValueDie2() {
        return this.die2.getValue();
    }

    /**
     * Checks if the values of the dice are equal.
     *
     * @return True if facevalues of die1 and die2 are the same, otherwise False.
     */
    public boolean getEns() {
        if (this.die1.getValue() == this.die2.getValue()) {
            return true;
        }
        return false;
    }

    /**
     * Checks if the values of the dice are equal to 6.
     *
     * @return True if both dice's facevalue are equal to 6, otherwise False.
     */
    public boolean getDoubleSix() {
        if (this.die1.getValue() == 6 && this.die2.getValue() == 6) {
            return true;
        }
        return false;
    }
    
    /**
     * Checks if the values of the dice are equal to 1.
     *
     * @return True if both dice's facevalue are equal to 1, otherwise False.
     */
    public boolean getDoubleOne() {
        if (this.die1.getValue() == 1 && this.die2.getValue() == 1) {
            return true;
        }
        return false;
    }
    
    /**
     * Method that makes a text with the most important values in the class, and some description.
     *
     * @return A coherent string with values of Die1 and Die2
     */
    @Override
	public String toString() {
        return "Die1 = " + this.die1.getValue() + ", Die2 = " + this.die2.getValue();
    }
}